function getExplorerInfo() {
	var explorer = window.navigator.userAgent.toLowerCase();
	//ie 
	if (explorer.indexOf("msie") >= 0) {
		var ver = explorer.match(/msie ([\d.]+)/)[1];
		return {
			type: "IE",
			version: ver
		};
	}
	//firefox 
	else if (explorer.indexOf("firefox") >= 0) {
		var ver = explorer.match(/firefox\/([\d.]+)/)[1];
		return {
			type: "Firefox",
			version: ver
		};
	}
	//Chrome
	else if (explorer.indexOf("chrome") >= 0) {
		var ver = explorer.match(/chrome\/([\d.]+)/)[1];
		return {
			type: "Chrome",
			version: ver
		};
	}
	//Opera
	else if (explorer.indexOf("opera") >= 0) {
		var ver = explorer.match(/opera.([\d.]+)/)[1];
		return {
			type: "Opera",
			version: ver
		};
	}
	//Safari
	else if (explorer.indexOf("Safari") >= 0) {
		var ver = explorer.match(/version\/([\d.]+)/)[1];
		return {
			type: "Safari",
			version: ver
		};
	}
}

//临时，手机端其它页都跳到首页
function tempJump() {
	var ww = window.innerWidth;
	var url = window.location.href;
	var list = url.split("/");
	var page = list[list.length - 1];
	var list2 = page.split('.');
	var name = list2[0];
	if (ww <= 768 && (name == 'ecjia' || name == 'about')) {
		location.href = "index.html"
	}
}
tempJump();

$(function () {
	$(window).resize(function () {
		tempJump();
	})

	// 手机端不可缩放，pc端可缩放
	function PC_MOB_RESIZE() {
		var ww = $(window).width();
		var roo = $("html");
		var MV = $("meta[name='viewport']")
		var MV_PC = "width=device-width, user-scalable=yes";
		var MV_MOBILE = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0";
		if (ww <= 768) {
			if (!roo.hasClass("html-mobile")) {
				roo.addClass("html-mobile").removeClass("html-pc");
				MV.attr("content", MV_MOBILE);
			}
		} else {
			if (!roo.hasClass("html-pc")) {
				roo.addClass("html-pc").removeClass("html-mobile");
				MV.attr("content", MV_PC);
			}
		}
	}
	$(window).resize(function () {
		PC_MOB_RESIZE();
	})
	PC_MOB_RESIZE();

	/* --------------------- index --------------------- */
	if ($(".page-index").length > 0) {
		$(window).scroll(function () {
			wt();
		});
		wt();

		function wt() {
			var wt = $(document).scrollTop();
			var hd = $(".page-index .header");
			if (wt > 0) {
				hd.addClass("header_down");
			} else {
				hd.removeClass("header_down");
			}
		}
	}

	$(".page-index .section-2 .section-tab .tab-item").mouseenter(function () {
		$(this).addClass("on").siblings().removeClass("on");

		/* --------------------- function --------------------- */
		$(".page-function .service_tabs li").mouseenter(function () {
			var index = $(this).index();
			$(this).addClass("current").siblings().removeClass("current");
			$(".service_con").find(".table").eq(index).show().siblings().hide();
		});

		/* --------------------- authorization --------------------- */
		// 手机端同步
		function sameAuthorUpdate() {
			var content1 = $(".page-authorization .page_pc .section-4 .mod-like-table").clone();
			var content2 = $(".page-authorization .page_pc .section-5 .mod-like-table").clone();
			var content3 = $(".page-authorization .page_pc .section-4-1 .mod-like-table").clone();
			var mobBody1 = $(".page-authorization .mob-s2-1 .s-content");
			var mobBody2 = $(".page-authorization .mob-s2-2 .s-content");
			var mobBody3 = $(".page-authorization .mob-s2-3 .s-content");
			// content1.find(".th p").each(function(){
			// 	var txt = simplePrice($(this).text());
			// 	console.log($(this))
			// 	$(this).text(txt)
			// })

			// content2.find(".th p").each(function(){
			// 	var txt = simplePrice($(this).text());
			// 	$(this).text(txt)
			// })
			// content3.find(".th p").each(function(){
			// 	var txt = simplePrice($(this).text());
			// 	$(this).text(txt)
			// })
			mobBody1.append(content1);
			mobBody2.append(content2);
			mobBody3.append(content3);


			function simplePrice(str) {
				// ￥19,000 转换成 19000
				return str.replace(/[￥\,]/g, '');
			}
		}
		sameAuthorUpdate();

		/* --------------------- faq --------------------- */
		$(".page-faq .course_main").slide({
			"titCell": ".tabs li",
			"mainCell": ".items",
			titOnClassName: "current"
		});

		/* --------------------- update --------------------- */
		$(".page-update .page_pc .update-warp").slide({
			titCell: ".update-tabs li",
			mainCell: ".update-content",
			titOnClassName: "curr"
		});
		$(".page-update .page_pc *[ectype='year']").on("click", function () {
			var val = $(this).data("value");

			$(".year-item-" + val + "").slideToggle(500);

			if ($(this).hasClass("down")) {
				$(this).removeClass("down");
			} else {
				$(this).addClass("down");
			}
		});
		// 手机端效果同步
		function sameUpdate() {
			var content = $(".page-update .page_pc .update-warp").clone();
			var mobBody = $(".page-update .mob-body");
			var pcTimes = $(".page-update .page_pc .update_quency");
			var mobTimes = $('.j-update-times-m');

			// 内容同步
			mobBody.append(content);
			mobTimes.text(pcTimes.find("span").text());

			// js特效同步
			$(".page-update .page_mobile .update-warp").slide({
				titCell: ".update-tabs li",
				mainCell: ".update-content",
				titOnClassName: "curr"
			});
			$(".page-update .page_mobile *[ectype='year']").on("click", function () {
				var val = $(this).data("value");

				$(".year-item-" + val + "").slideToggle(500);

				if ($(this).hasClass("down")) {
					$(this).removeClass("down");
				} else {
					$(this).addClass("down");
				}
			});
		}
		sameUpdate();

		/* --------------------- manual --------------------- */
		$(".page-manual .manual-warp").slide({
			titCell: ".manual-tabs li",
			mainCell: ".manual-content",
			titOnClassName: "curr"
		});

		/* --------------------- saas --------------------- */
		$(".page-saas [ectype='card-area'] li").hover(function () {
			$(this).addClass("active").siblings().removeClass("active");
		});

		/* --------------------- about --------------------- */
		// 关于我们页面切换
		function getHash() {
			arg = location.href.split("#");
			return arg[1];
		}

		function setAboutTabLine(index) {
			if ($(".body-about").length == 0) return;
			var step = 196; //一个item的宽度
			var left = step * index;
			$(".body-about .subnav .tips1").show().css({
				"left": left + "px"
			});
		}

		function setAboutTab() {
			if ($(".body-about").length == 0) return;
			var hash = getHash();
			var arr = ['index', 'contact', 'team', 'office', 'honor'];
			if (!hash) {
				hash = "index"
			}
			var index = arr.indexOf(hash);
			var boxs = $(".body-about .about-details .detail-item")
			boxs.eq(index).show().siblings(":visible").hide();
			setAboutTabLine(index);
		}
		setAboutTab();
		$(".body-about .subnav li a").click(function () {
			setTimeout(function () {
				setAboutTab();
			}, 200)
		})
	})
})